package com.personal.book1.controller;

import com.personal.book1.model.BookInfo;
import com.personal.book1.service.BookService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

// 用户从这里拿取数据
@RestController
@RequestMapping("/book")
public class BookController {
    @Autowired
    private BookService bookService;

    @RequestMapping("/getList")
    public List<BookInfo> getList() {
        // 1.从数据库中获取数据
        List<BookInfo> bookInfos = bookService.getBookList();

        // 2.返回数据
        return bookInfos;
    }
}
